﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Windows.Forms;
namespace FTPclient
{
    class File_1
    {
        public static void openFile(TreeView treeView)
        {
            DriveInfo[] dr = DriveInfo.GetDrives();
            string driveName = "";
            foreach (DriveInfo d in dr)
            {
                switch (d.DriveType)
                {
                    case DriveType.Fixed:
                        driveName = "本地磁盘(" + d.Name.Substring(0, 2) + ")";
                        break;
                    case DriveType.Removable:
                        driveName = "可移动磁盘(" + d.Name.Substring(0, 2) + ")";
                        break;
                    case DriveType.CDRom:
                        driveName = "DVD驱动器(" + d.Name.Substring(0, 2) + ")";
                        break;
                    case DriveType.Network:
                        driveName = "网络驱动器(" + d.Name.Substring(0, 2) + ")";
                        break;
                    default:
                        driveName = "未知(" + d.Name + ")";
                        break;
                }
                treeView.Nodes.Add(d.Name, driveName);
            }
        }
    }
}
